<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>数组扩展</title>
</head>
<body>
<script>
    let arr = [1, 2, 3, 4, 5, 6, 7, 8];
    //find函数会循环遍历数组,箭头函数中的是判断的逻辑,如果是true的话,则返回相应的值
    let number = arr.find(element => element === 7);
    console.log(number)

    //对象数组

    let arr2 = [{
        id: 1109,
        name: "刘德华",
        age: 30
    },
        {
            id: 1110,
            name: "刘德华",
            age: 30
        },
        {
            id: 1111,
            name: "刘德华",
            age: 30
        },
        {
            id: 1112,
            name: "刘德华",
            age: 30
        },
        {
            id: 1113,
            name: "刘德华",
            age: 30
        }
    ];

    console.log(arr2.find(user=>user.id===1113))


</script>
</body>
</html>